<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl">

  <xsl:param name="xopus"/>
  <xsl:param name="show-draft-comments" select="'false'"/>
  <xsl:param name="show-required-cleanups" select="'false'"/>

  <xsl:include href="common.xsl"/>

  <xsl:template match="*[contains(@class, 'map/map ')]">
    <div class="map map-map">
      <xsl:apply-templates select="node()"/>
    </div>
  </xsl:template>

  <xsl:template match="*[contains(@class, 'map/map ')]/*[contains(@class, 'topic/title ')]">
    <h1>
      <xsl:apply-templates select="node()"/>
    </h1>
  </xsl:template>

  <xsl:template match="*[contains(@class, ' map/topicref ')]">
    <div class="topicref">
      <div>
        <a>
          
          <xsl:choose>
            <xsl:when test="$xopus = 'true'">
              <xsl:attribute name="href">view-xopus-island_remote.php?path=<xsl:value-of select="@search"/>&amp;r=cmis/show</xsl:attribute>
              <xsl:attribute name="ondblclick">Editor.setURL(this.href);return false;</xsl:attribute>
              <xsl:attribute name="title">Double click this link to open document</xsl:attribute>
            </xsl:when>
            <xsl:otherwise>
              <xsl:copy-of select="@href"/>
            </xsl:otherwise>
          </xsl:choose>

          <xsl:choose>
            <xsl:when test="not(@navtitle) and not(@href)">
              <span class="dummy">&lt;Topic Reference/&gt;</span>
            </xsl:when>
            <xsl:when test="@navtitle">
              <xsl:value-of select="@navtitle"/>
            </xsl:when>
            <xsl:when test="included/*/titlealts/navtitle">
              <xsl:value-of select="included/*/titlealts/navtitle"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="included/*/title[1]"/>
            </xsl:otherwise>
          </xsl:choose>
			<xsl:value-of select="@href"/>
        </a>
      </div>
      <xsl:apply-templates select="*[not(self::included)]"/>
    </div>
    <xsl:if test="not(following-sibling::*[not(self::included)])">
      <div class="ui-panel">
        <span onclick="return addNode(node, 'topicref');" class="ui-button-insert">Add Topic Reference here</span>
      </div>
    </xsl:if>
  </xsl:template>

  <xsl:template match="*[contains(@class, ' map/topicref mapgroup-d/topicgroup ')]">
    <div class="topicgroup">
      <xsl:apply-templates select="node()"/>
    </div>
  </xsl:template>

</xsl:stylesheet>

